package com.j4dream.webapp.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Handles requests for the application home page.
 */
@Controller
public class HomeController {

	private static final Logger logger = LoggerFactory.getLogger(HomeController.class);

	/**
	 * Simply selects the home view to render by returning its name.
	 */
	@ResponseBody
	@RequestMapping(value = "/", method = RequestMethod.GET)
	public List<String> home(Locale locale) {
		List<String> test = new ArrayList<String>();
		for (int i = 0; i < 10; i++) {
			test.add("" + i);
		}
		return test;
	}

	@ResponseBody
	@RequestMapping(value = "/app/", method = RequestMethod.GET)
	public List<String> home2(Locale locale, @RequestBody String model) {
		List<String> test = new ArrayList<String>();
		for (int i = 0; i < 10; i++) {
			test.add("" + i);
		}
		test.add(model);
		return test;
	}

}
